package com.clas.liu.myapplication.view.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 字符工具类
 * Created by liu on 2019/4/14.
 */

public class StringUtil {
    public static boolean isMobile(String str) {
        Pattern p = null;
        Matcher m = null;
        boolean b = false;
        String s2 = "^[1](([3|5|8|7][\\d])|([4][5,6,7,8,9])|([6][5,6])|([7][3,4,5,6,7,8])|([9][8,9]))[\\d]{8}$";// 验证手机号
        if (str == null || str.equals(""))
            return false;
        p = Pattern.compile(s2);
        m = p.matcher(str);
        b = m.matches();
        return b;
    }

    public static boolean isEmpty(String str) {
        return (str == null || str.trim().length() == 0);
    }
    public static boolean isInteger(String str) {
        Pattern pattern = Pattern.compile("^[\\d]*$");
        return pattern.matcher(str).matches();
    }
}
